package mqpaydemo.paydemo.pay.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import mqpaydemo.paydemo.pay.api.UserService;
import mqpaydemo.paydemo.pay.orm.entity.User;
import mqpaydemo.paydemo.pay.orm.mapper.UserMapper;
import mqpaydemo.paydemo.pay.request.UserRequest;
import mqpaydemo.paydemo.pay.response.Result;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author ljs
 * @since 2021-09-10
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
     @Resource
    UserMapper userMapper;
    @Override
    public Result<User> login(UserRequest userRequest) {
        QueryWrapper queryWrapper=new QueryWrapper();
        queryWrapper.eq("usernam",userRequest.getUsernam());
        queryWrapper.eq("password",userRequest.getPassword());
        User user=    userMapper.selectOne(queryWrapper);
        return Result.ofSuccess(user);
    }
}
